package com.hhoss.aspi;

import java.io.Serializable;
import java.util.Collection;

public interface Factory<S extends Serializable,F> {
	/**
	 * @return the factory name
	 */
	String getName();
	/**
	 * @return the support names of generated instance
	 */
	Collection<S> supports();
	/**
	 * @param klass the target instance class
	 * @return boolean true if this factory support generate the instance of F
	 */
	boolean support(Class<?> klass);
	/**
	 * @param key the key of instance 
	 * @param params the parameters for generate the instance
	 * @return
	 */
	F get(S key, Object... params);
	/**
	 * @param klass the target class for generate instance
	 * @param params the parameters for generate the instance
	 * @return the instance generated by the factory
	 */
	F get(Class<F> klass, Object... params);
}
